$(function () {
    var userName = localStorage.getItem("user");
    $.getJSON("easybuy/Car/selectCars",
        {"userName":userName},
        function (data) {
            var sumPrice = 0;
            var sumJf = 0;
            $(".i_bg .car_tab").eq(0).html("<tr>\n" +
                "                <td class=\"car_th\" width=\"550\">商品名称</td>\n" +
                "                <td class=\"car_th\" width=\"140\">属性</td>\n" +
                "                <td class=\"car_th\" width=\"150\">购买数量</td>\n" +
                "                <td class=\"car_th\" width=\"130\">小计</td>\n" +
                "                <td class=\"car_th\" width=\"140\">返还积分</td>\n" +
                "              </tr>");
            for (var i = 0; i < data.length; i++) {
                $(".i_bg .car_tab").eq(0).append("<tr>\n" +
                    "                <td>\n" +
                    "                    <div class=\"c_s_img\"><img src=\"images/"+data[i].fileName+"\" width=\"73\" height=\"73\" /></div>\n" +
                     data[i].name +
                    "                </td>\n" +
                    "                <td align=\"center\">颜色：灰色</td>\n" +
                    "                <td align=\"center\">"+data[i].count+"</td>\n" +
                    "                <td align=\"center\" style=\"color:#ff4e00;\">￥"+(data[i].count*data[i].price)+"</td>\n" +
                    "                <td align=\"center\">"+(data[i].count*26)+"R</td>\n" +
                    "              </tr>");
                sumPrice = sumPrice+data[i].price*data[i].count;
                sumJf = sumJf+26*data[i].count;
            }
            $(".i_bg .car_tab").append("<tr>\n" +
                "                <td colspan=\"5\" align=\"right\" style=\"font-family:'Microsoft YaHei';\">\n" +
                "                    商品总价：￥"+sumPrice+" ； 返还积分 "+sumJf+"R  \n" +
                "                </td>\n" +
                "              </tr>");
            $(".mytable").html("<tr>\n" +
                "                <td align=\"right\">\n" +
                "                \t该订单完成后，您将获得 <font color=\"#ff4e00\">"+sumJf+"</font> 积分 ，以及价值 <font color=\"#ff4e00\">￥0.00</font> 的红包 <br />\n" +
                "                    商品总价: <font color=\"#ff4e00\">￥"+sumPrice+"</font>  + 配送费用: <font color=\"#ff4e00\">￥15.00</font>\n" +
                "                </td>\n" +
                "              </tr>\n" +
                "              <tr height=\"70\">\n" +
                "                <td align=\"right\">\n" +
                "                \t<b style=\"font-size:14px;\">应付款金额：<span style=\"font-size:22px; color:#ff4e00;\">￥"+(sumPrice+15)+"</span></b>\n" +
                "                </td>\n" +
                "              </tr>\n" +
                "              <tr height=\"70\">\n" +
                "                <td align=\"right\"><a href=\"javascipt:void(0)\" class='mya'><img src=\"images/btn_sure.gif\" /></a></td>\n" +
                "              </tr>");
        });
});